// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程：https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
module.exports = {
  _before: function () {
    // 通用预处理器
  },

  async getDashboard() {
    let res = await uniCloud
      .databaseForJQL()
      .collection('mo-unicloud-index')
      .field('_id,title,cover,url')
      .get()
    return res
  },

  async getDashboardDetail() {
    const { body = {} } = this.getHttpInfo()
    const { params } = JSON.parse(body)

    let res = await uniCloud
      .databaseForJQL()
      .collection('mo-unicloud-index')
      .where({ _id: params._id })
      .get({ getOne: true })

    return res
  }
}
